package sketch.ounit;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import org.eclipse.jdt.core.dom.CompilationUnit;

import sketch.ast.ASTUtils;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class ObservationInstantiationVisitorTest extends TestCase {
	
	public static Test suite() {
		return new TestSuite(ObservationInstantiationVisitorTest.class);
	}
	
	public void testInstantionVisitor() {
		String filePath = "./testfiles/sketch/instrumenter/SampleCodeAfterRemovingParenthesis.java";
		CompilationUnit unit = ASTUtils.astRoot(filePath);
		Map<Integer, String> results = new HashMap<Integer, String>();
		results.put(23, "1");
		results.put(25, "2");
		results.put(27, "3");
		results.put(29, "4");
		Map<String, Map<Integer, String>> map = new LinkedHashMap<String, Map<Integer, String>>();
		map.put("rewriteSize", results);
		ObservationInstantiationVisitor visitor = new ObservationInstantiationVisitor(unit, map);
		visitor.visit(unit);
		
		System.out.println("after observation replacement: ");
		System.out.println(unit);
	}
}